<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
    <title>骆米智慧校园</title>
  
</head>
<body>
    <div id="con" class="con">

    </div>
</body>
</html>
<style>
    .con{
        width: 100%;
        height: 300px;
        background: red;

        margin: 0 auto;
    position: relative;
    white-space: nowrap;
    font-size: 0;
    }
</style>
<script>

    var con = document.getElementById('con')
    var x = 0
    var y = 0
    var left = ''
    function touchStart (e){

            x = e.targetTouches[0].clientX
            y = e.targetTouches[0].clientX

         


    }
    con.addEventListener('touchstart',touchStart, true)

            function touchMove(e){


            var moveX = e.targetTouches[0].clientX
            var moveY = e.targetTouches[0].clientX
            this.offsetX = moveX - x
            this.offsetY = moveY - y
       

            con.style.left = (this.offsetX) + 'px'     
            
    }
    con.addEventListener('touchmove',touchMove, true)

            function touchEnd(){

                alert('end')
            }
            con.addEventListener('touchend',touchEnd, true)
</script>